<?php

class Dcmp_Component_Result_View extends Dcmp_Component_Result_Base {

    private $_actionName = NULL;
    private $_controllerName = NULL;
    private $_componentName = NULL;

    public function getComponentName(){
        return $this->_componentName;
    }
    public function setComponentName($value){
        $this->_componentName = $value;
        return $this;
    }

    public function getActionName() {
        if (is_null($this->_actionName)) {
            $this->_actionName = Kd_Web::getRouter()->getAction();
        }
        return $this->_actionName;
    }

    public function setActionName($value) {
        $this->_actionName = $value;
        return $this;
    }

    public function getControllerName() {
        return $this->_controllerName;
    }

    public function setControllerName($value) {
        $this->_controllerName = $value;
        return $this;
    }

    public function execute() {
        $view = $this->getComponent()->loadView($this->getActionName(), $this->getControllerName());
        $view->addData($this->getAllData());
        Kd_Web::getResponse()->write($view->render());
    }

}